package org.pinda.gui;

import org.johnnei.engine.render.Renderable;

public class GuiComponent extends Renderable {

	/**
	 * The parent Gui
	 */
	protected Gui parent;
	protected float x;
	protected float y;
	protected float width;
	protected float height;
	
	public GuiComponent(Gui parent, int flags) {
		super(flags);
		this.parent = parent;
	}
	
	final protected Gui getParent() {
		return parent;
	}
	
	/**
	 * Sets the measured fps<br/>
	 * Only used in {@link GuiGame}
	 * @param fps The measured fps
	 */
	public void setFps(int fps) {
	}

	@Override
	public boolean canDelete() {
		return false;
	}
	
	/**
	 * Will be called if a mouseButton has been pressed
	 * @param mouseButton The mouse button which was pressed
	 * @param x The x location scaled to the dimensions of OpenGL and the actual window
	 * @param y The y location scaled to the dimensions of OpenGL and the actual window 
	 */
	public void onClick(int mouseButton, int x, int y) {
	}
	
	/**
	 * Will be called if a key on the KeyBoard has been pressed down (not when released)
	 * @param key The character of the key which has been pressed
	 */
	public void onKeyPress(char key) {
	}
	
	public void removeFocus() {
		
	}
	
	public boolean hasFocus() {
		return false;
	}
	
	public float getX() {
		return x;
	}

	public float getY() {
		return y;
	}
	
	public float getCenterX() {
		return x + (width / 2);
	}
	
	public float getCenterY() {
		return y + (height / 2);
	}
	
	public float getWidth() {
		return width;
	}
	
	public float getHeight() {
		return height;
	}
}
